<?php

/**
 * Created by PhpStorm.
 * User: 张彪
 * Date: 2016/5/12 0012
 * Time: 下午 3:01
 */
class Ziying extends Base_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->model('ziying_model');
        $this->load->model('comment_model');
        $this->load->model('category_model');
    }

    public function getlist()
    {
        if(empty($_GET['cityId']))
        {
            $this->error('城市不能为空');
        }
        $ziying = $this->ziying_model->getList(array('city'=>$_GET['cityId']));
        $this-$this->success($ziying);
    }

    public function detail()
    {
        $id = $_GET['id'];
        $data = $this->ziying_model->detail($id);
        $con_data['type'] = 'ZIYING';
        $con_data['id'] = $id;
        $con_data['limit'] = 5;
        $con_data['offset'] = 0;
        $coms = $this->comment_model->getActivityOrTrackComments($con_data);
        $data['coms'] = $coms;
        $this->success($data);

    }

    public function gettype()
    {
        $data =  $this->category_model->all_categories(array('parentId'=>4,'type'=>'MAINCAT','select'=>'id,name'));
        $this->success($data);
    }

}